import {store} from '../index'
import {defineStore} from 'pinia'

interface LsdState {
    patData: any
    patActive: any
}

export const useLsdStore = defineStore({
    id: 'lsd',
    state: (): LsdState => {
        return {
            patData: {},
            patActive: {} //当前展示的患者
        }
    },
    getters: {},
    actions: {
        setPatData(data: any) {
            this.patData = data
        },
        setPatActive(data: any) {
            const obj = Object.assign({}, data)
            obj.chronicDiseaseArr = obj.chronicDisease || ''.split(',').filter((item) => item != '')
            this.patActive = obj
        }
    }
})

export const useLsdStoreWithOut = () => {
    return useLsdStore(store)
}
